5e2e1bd31fa665958b8bee4c5b684444fab72dad,gravitee-gateway-services/gravitee-gateway-services-sync/src/test/java/io/gravitee/gateway/services/sync/SyncManagerTest.java,SyncManagerTest,test_shouldUpdateIfLastEventIsStartAPI,#,431
Before Change
events.add(mockEvent);
events.add(mockEvent2);
when(eventRepository.findByType(Arrays.asList(EventType.PUBLISH_API, EventType.UNPUBLISH_API, EventType.START_API, EventType.STOP_API))).thenReturn(Collections.singleton(mockEvent));
when(apiRepository.findAll()).thenReturn(Collections.singleton(api));
syncManager.refresh();
when(eventRepository.findByType(Arrays.asList(EventType.PUBLISH_API, EventType.UNPUBLISH_API, EventType.START_API, EventType.STOP_API))).thenReturn(events);
when(apiRepository.findAll()).thenReturn(Collections.singleton(api2));
when(apiManager.get(api.getId())).thenReturn(mockApi);
After Change
events.add(mockEvent2);
when(eventRepository.search(
new EventCriteria.Builder()
.types(EventType.PUBLISH_API, EventType.UNPUBLISH_API, EventType.START_API, EventType.STOP_API)
.build()
)).thenReturn(Collections.singletonList(mockEvent));
when(apiRepository.findAll()).thenReturn(Collections.singleton(api));
syncManager.refresh();
when(eventRepository.search(
new EventCriteria.Builder()
.types(EventType.PUBLISH_API, EventType.UNPUBLISH_API, EventType.START_API, EventType.STOP_API)
.build()
)).thenReturn(events);
when(apiRepository.findAll()).thenReturn(Collections.singleton(api2));
when(apiManager.get(api.getId())).thenReturn(mockApi);